{template "header.html"}
<script type="text/javascript">
    $(function() { //防止回车提交表单
        document.onkeydown = function(e){
            var ev = document.all ? window.event : e;
            if (ev.keyCode==13) {
                return false;
            }
        }
    });

    function dr_show_catid(catid) {
        if ($('.dr_cat_'+catid).is(":hidden")){
            $('.fc-cat-user').hide();
            $('.dr_cat_'+catid).show(200);
        }else{
            $('.dr_cat_'+catid).hide(200);
        }
    }

    $(function(){
        var table = $('.table-checkable');
        table.find('.group-checkable').change(function () {
            var set = jQuery(this).attr("data-set");
            var checked = jQuery(this).is(":checked");
            jQuery("."+set).each(function () {
                if (checked) {
                    $(this).prop("checked", true);
                    $(this).parents('tr').addClass("active");
                } else {
                    $(this).prop("checked", false);
                    $(this).parents('tr').removeClass("active");
                }
            });
        });
    });
</script>
<form class="form-horizontal" role="form" id="myform">
    {$form}
    <div class="form-body">
        <div class="table-scrollable">
            <table class="fc-cat-table table table-striped table-bordered  table-checkable dataTable">
                <thead>

                <tr class="heading">
                    <th width="200"></th>
                    <th class="dr_option_xx" style="text-align: left">
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('访问')}
                            <input type="checkbox" class="checkboxes group-checkable dr_cat_{$catid}_show" data-set="dr_cat_{$catid}_show" />
                            <span></span>
                        </label>
                        {if $cat.is_post}
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('发布')}
                            <input type="checkbox" class="checkboxes group-checkable dr_cat_{$catid}_add" data-set="dr_cat_{$catid}_add" />
                            <span></span>
                        </label>
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('修改')}
                            <input type="checkbox" class="checkboxes group-checkable dr_cat_{$catid}_edit" data-set="dr_cat_{$catid}_edit" />
                            <span></span>
                        </label>
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('删除')}
                            <input type="checkbox" class="checkboxes group-checkable dr_cat_{$catid}_del" data-set="dr_cat_{$catid}_del" />
                            <span></span>
                        </label>
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('验证码')}
                            <input type="checkbox" class="checkboxes group-checkable dr_cat_{$catid}_code" data-set="dr_cat_{$catid}_code" />
                            <span></span>
                        </label>
                        {/if}
                    </th>
                </tr>
                </thead>
                <tbody>
                {loop $list $i $t}
                <tr class="odd gradeX">
                    {if $t.level}
                    <td colspan="99"> {$t.name} </td>
                    {else}
                    <td {$t.space}>{$t.name}</td>
                    <td class="dr_option_xx">

                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('访问')}
                            <input type="checkbox" class="checkboxes dr_cat_{$catid}_show" {if !in_array($i, (array)$auth['category'][$cat.id]['show'])} checked {/if} name="data[show][]" value="{$i}" />
                            <span></span>
                        </label>

                        {if $cat.is_post}
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('发布')}
                            <input type="checkbox" class="checkboxes dr_cat_{$catid}_add" {if !in_array($i, (array)$auth['category'][$cat.id]['add'])} checked {/if} name="data[add][]" value="{$i}"/>
                            <span></span>
                        </label>
                        {if $i>0}
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('修改')}
                            <input type="checkbox" class="checkboxes dr_cat_{$catid}_edit" {if !in_array($i, (array)$auth['category'][$cat.id]['edit'])} checked {/if} name="data[edit][]" value="{$i}" />
                            <span></span>
                        </label>
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('删除')}
                            <input type="checkbox" class="checkboxes dr_cat_{$catid}_del" {if !in_array($i, (array)$auth['category'][$cat.id]['del'])} checked {/if} name="data[del][]" value="{$i}" />
                            <span></span>
                        </label>
                        {else}
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('修改')}
                            <input type="checkbox" class="checkboxes dr_cat_{$catid}_edit" disabled />
                            <span></span>
                        </label>
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('删除')}
                            <input type="checkbox" class="checkboxes dr_cat_{$catid}_del" disabled />
                            <span></span>
                        </label>
                        {/if}
                        <label class="mt-table mt-checkbox mt-checkbox-single mt-checkbox-outline">
                            {dr_lang('验证码')}
                            <input type="checkbox" class="checkboxes dr_cat_{$catid}_code" {if !in_array($i, (array)$auth['category'][$cat.id]['code'])} checked {/if} name="data[code][]" value="{$i}" />
                            <span></span>
                        </label>
                        <br>
                        <label>
                            <select name="data[verify][{$i}]" class="form-control">
                                <option value="0"> {dr_lang('不审核')} </option>
                                {loop $verify $v}
                                <option value="{$v.id}" {if $auth['category'][$cat.id]['verify'][$i] == $v.id} selected{/if}> {dr_lang($v.name)} </option>
                                {/loop}
                            </select>
                        </label>
                        {if $i>0}
                        <div class="input-inline input-small">
                            <div class="input-group">
                                <input type="text" name="data[exp][{$i}]" value="{htmlspecialchars($auth['category'][$cat.id]['exp'][$i])}" class="form-control" placeholder="">
                                <span class="input-group-addon">+{SITE_EXPERIENCE}</span>
                            </div>
                        </div>
                        <div class="input-inline input-small">
                            <div class="input-group">
                                <input type="text" name="data[score][{$i}]" value="{htmlspecialchars($auth['category'][$cat.id]['score'][$i])}" class="form-control" placeholder="">
                                <span class="input-group-addon">±{SITE_SCORE}</span>
                            </div>
                        </div>
                        <div class="input-inline input-small">
                            <div class="input-group">
                                <input type="text" name="data[day_post][{$i}]" value="{htmlspecialchars($auth['category'][$cat.id]['day_post'][$i])}" class="form-control" placeholder="">
                                <span class="input-group-addon">{dr_lang('日投稿')}</span>
                            </div>
                        </div>
                        <div class="input-inline input-small">
                            <div class="input-group">
                                <input type="text" name="data[total_post][{$i}]" value="{htmlspecialchars($auth['category'][$cat.id]['total_post'][$i])}" class="form-control" placeholder="">
                                <span class="input-group-addon">{dr_lang('投稿总数')}</span>
                            </div>
                        </div>
                        {/if}
                        {/if}

                    </td>
                    {/if}
                </tr>
                {/loop}
                </tbody>
            </table>
        </div>
        <p style="padding: 10px; margin: 0">
            {dr_lang('±功能表示：正数为增加值，负数为扣减值')}
        </p>

    </div>
</form>
<style>
    .dr_option_xx {
        text-align: left !important;
    }
    .dr_option_xx .mt-checkbox {
        margin-right: 10px;
        margin-bottom: 5px;
    }
</style>
{template "footer.html"}